﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using bVideo = Portal.Core.Customer.bVideo;

public partial class Controls_View_WatchVideo : System.Web.UI.UserControl
{
    int Id_Video = 1, Id_Data = 1;
    string[] ListSourceVideo, ListIDPartVideo;
    public string Path_current = "", Path_script = "", Source_Current = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        Path_current = HttpContext.Current.Request.Url.AbsoluteUri;
        Path_script = Infomations.UrlScript;
        if (Request.QueryString["id"] != null)
        {
            Id_Video = int.Parse(Request.QueryString["id"].ToString());
        }
        if (Request.QueryString["data"] != null)
        {
            Id_Data = int.Parse(Request.QueryString["data"].ToString());
        }
        if (!IsPostBack)
        {
            bVideo.GetDetailVideoForID(Id_Video);
            bVideo.GetSourceLinkForID(Id_Video);
            ListSourceVideo = bVideo.ListSourceLink;
            ListIDPartVideo = bVideo.ListIDPartLink;
        }
        Source_Current = ReSourceLinkForIDPart(Id_Data.ToString());
    }
    public string ReSourceLinkForIDPart(string IdPart)
    {
        int k = 0;
        for (int i = 0; i < ListIDPartVideo.Length; i++)
        {
            if (IdPart.Equals(ListIDPartVideo[i]))
            {
                k = i;
                break;
            }
        }
        return ListSourceVideo[k];
    }
}